home *** CD-ROM | disk | FTP | other *** search
- /***********************************************
- htbtree.dll
-
- htbtree.cpp
-
- Copyright TransEra Corporation 1999.
- ************************************************/
-
- #include "stdafx.h"
- #include "htbtree.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- BEGIN_MESSAGE_MAP(CHtbtreeApp, CWinApp)
- //{{AFX_MSG_MAP(CHtbtreeApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- CHtbtreeApp::CHtbtreeApp()
- {
- }
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: BrowseCallbackProc
-
- Description: Call pack Function
-
- Return type:
- Argument: HWND hwnd
- Argument: UINT uMsg
- Argument: LPARAM lp
- Argument: LPARAM pData
-
- Notes: Serves as message pump
-
- */
-
- int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
- {
- TCHAR szDir[MAX_PATH];
-
- switch(uMsg)
- {
- case BFFM_INITIALIZED:
- {
- if ( GetCurrentDirectory(sizeof(szDir)/sizeof(TCHAR), szDir))
- {
- // WParam is TRUE since you are passing a path.
- // It would be FALSE if you were passing a pidl.
- SendMessage(hwnd,BFFM_SETSELECTION,TRUE,(LPARAM)szDir);
- }
- break;
- }
- case BFFM_SELCHANGED:
- {
- // Set the status window to the currently selected path.
- if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir)) {
- SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir);
- }
- break;
- }
- default:
- break;
- }
- return 0;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: Tctrl
-
- Description: Calls Tree Control
-
- Return type: void
- Argument: char * StaticTitle
- Argument: char * ReturnPath
-
- Notes: Calls tree control and returns pathname to HTBasic.
-
- */
-
- void Tctrl(char * StaticTitle, char * ReturnPath)
- {
- BROWSEINFO bi;
- LPITEMIDLIST pidl;
- LPMALLOC pMalloc;
-
- if (SUCCEEDED(SHGetMalloc(&pMalloc)))
- {
- ZeroMemory(&bi,sizeof(bi));
- bi.hwndOwner = NULL;
- bi.pszDisplayName = 0;
- bi.lpszTitle = StaticTitle;
- bi.pidlRoot = 0;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
- bi.ulFlags &= ~BIF_DONTGOBELOWDOMAIN;
- bi.ulFlags &= ~BIF_BROWSEFORCOMPUTER;
- bi.ulFlags &= ~BIF_BROWSEFORPRINTER;
- bi.lpfn = BrowseCallbackProc;
-
- pidl = SHBrowseForFolder(&bi);
- if (pidl) {
- SHGetPathFromIDList(pidl,ReturnPath);
- pMalloc->Free(pidl);
- pMalloc->Release();
- }
- }
- }